<html>
 <head></head>
 <body>
  <script src="http://open.web.meitu.com/sources/xiuxiu.js" type="text/javascript"></script>
  <script type="text/javascript">
  window.onload=function(){
    /*第1个参数是加载编辑器div容器，第2个参数是编辑器类型，第3个参数是div容器宽，第4个参数是div容器高*/
    xiuxiu.embedSWF("altContent",5,"650px","440px");
    //修改为您自己的图片上传接口
    xiuxiu.setUploadURL('http://<?php echo $_SERVER["HTTP_HOST"] ?>__CONTROLLER__/facesave');
    xiuxiu.setUploadType(2);
    xiuxiu.setUploadDataFieldName("upload_file");  //文本空间的name
    xiuxiu.onInit = function ()
    {
      <if condition="empty($_SESSION['face'])">
        xiuxiu.loadPhoto("http://open.web.meitu.com/sources/images/1.jpg");//修改为要处理的图片url 初始的图片
      <else/>
        xiuxiu.loadPhoto("http://<?php echo $_SERVER['HTTP_HOST'] ?>__ROOT__/<?php echo $_SESSION['face'] ?>");//修改为要处理的图片url 初始的图片
        // xiuxiu.loadPhoto("http://open.web.meitu.com/sources/images/1.jpg");//修改为要处理的图片url 初始的图片
     </if>
      
    }

    xiuxiu.onUploadResponse = function (data)
    {
      var dataobj = eval('(' + data + ')');
      if(dataobj.error == 0){
        $('.user-avatar').css("background-image","url("+dataobj.file_path+")");
        // alert('头像修改成功' + dataobj.file_path);
      }else{
        alert('修改失败')
      }
      
    }
  }
  </script>
  <div class="wrap">
   <div class="container">
    <div class="row">
     <div id="secondary" class="col-md-2">
      <nav class="list-group mt30">
       <a href="{:U('home/User/userinfo')}" class="list-group-item ">个人资料</a>
       <a href="javascript:void()" class="list-group-item active">头像上传<i style="line-height: 20px;font-size: 12px;color: #999;" class="pull-right fa fa-external-link-square"></i></a>
       <a href="{:U('home/User/useremail')}" class="list-group-item">Email 地址</a>
       <a href="{:U('home/user/userpassword')}" class="list-group-item">密码修改</a>
       <a href="/user/settings?tab=oauth" class="list-group-item">第三方账号</a>
      </nav>
      <nav class="list-group mt30">
       <a href="/user/settings?tab=notify" class="list-group-item">通知和私信</a>
       <a href="/user/settings?tab=card" class="list-group-item">个性名片</a>
       <a href="/user/settings?tab=block" class="list-group-item">屏蔽名单</a>
       <a href="/user/settings?tab=lab" class="list-group-item">实验室功能</a>
      </nav>
     </div>
     <!-- end #secondary -->
     <div id="main" class="settings col-md-10 form-horizontal">
      <h2 class="h3 mt30 post-title">头像上传</h2>
      <div class="row mt30">
       <div class="col-md-3 col-md-push-9">
       </div>
       <div class="col-md-8 col-md-pull-3">
        <div id="altContent"></div>
       </div>
      </div>
     </div>
    </div>
   </div>
  </div>
</html>

<script type="text/javascript">
  
  // document.write('http://<?php echo $_SERVER["HTTP_HOST"] ?>__CONTROLLER__/faceupload');
 // document.write('http://<?php echo $_SERVER["HTTP_HOST"] ?>'); 
 // document.write('http://<?php echo $_SERVER["HTTP_HOST"] ?>__CONTROLLER__/saveface');


</script>